package operatori;

import functii.elementare.Putere;

public class Cat extends Operator{
    @Override
    public double calcul(double aux1, double aux2){
        return aux1 / aux2;
    }
    public static double Calcul(double aux1, double aux2){
        return aux1 / aux2;
    }

     public double calculDerivata(){
        if(fStang == null || fDrept == null)
            System.exit(1);
        return calcul(Minus.Calcul(Produs.Calcul(fStang.calculDerivata(), fDrept.calcul()), Produs.Calcul(fStang.calcul(), fDrept.calculDerivata())), Putere.calcul(fDrept.calcul()));
    }

    public String derivare(){
        if(fStang == null || fDrept == null)
            System.exit(1);
        return concatTermeni(Minus.concatTermens(Produs.concatTermens(fStang.derivare(), fDrept.toString()), Produs.concatTermens(fStang.toString(),fDrept.derivare())), Putere.concatTermens(fDrept.toString()));
    }

    public String concatTermeni(String aux1, String aux2){
        String aux;
        if(aux1.compareTo("0") == 0 || aux2.compareTo("0") == 0)
            aux = aux1;
        else
            if(aux1.compareTo("0") == 0)
                aux = aux2;
            else
                if(aux2.compareTo("0") == 0)
                    aux = aux1;
                else
                    aux = aux1 + "/" + aux2;
        return aux;
    }

    public static String concatTermens(String aux1, String aux2){
        String aux;
        if(aux1.compareTo("0") == 0 || aux2.compareTo("0") == 0)
            aux = aux1;
        else
            if(aux1.compareTo("0") == 0)
                aux = aux2;
            else
                if(aux2.compareTo("0") == 0)
                    aux = aux1;
                else
                    aux = aux1 + "/" + aux2;
        return aux;
    }
	@Override
	public double calcul() {
		// TODO Auto-generated method stub
		return 0;
	}
}
